package service.impl;

import mapper.AdminMapper;
import mapper.UserMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import pojo.Admin;
import pojo.User;
import service.AdminService;
import service.UserService;

import javax.annotation.Resource;
import java.util.List;

@Service("adminService")
public class AdminServiceImpl implements AdminService {
    //自动装配
    @Resource
    private AdminMapper adminMapper;

    @Override
    public Admin adminLogin(@Param("adminId")int adminId) {
        return adminMapper.adminLogin(adminId);
    }

    @Override
    //更改资料
    public int updateAdmin(Admin admin) {
        return adminMapper.updateAdmin(admin);
    }

    @Override
    public int updateAdminpwd(Admin admin) {
        return adminMapper.updateAdminpwd(admin);
    }
    @Override
    public int insert(Admin admin) {
        return adminMapper.insert(admin);
    }
    @Override
    public List<Admin> selectWebAdmin() {
        return adminMapper.selectWebAdmin();
    }
    @Override
    public int delete(int adminId) {
        return adminMapper.delete(adminId);
    }
    @Override
    public int deletes(int[] adminIds) {
        int rows=0;
        for (int id : adminIds) {
            rows+=delete(id);
        }
        return rows;
    }


}
